<!--
 * @Author: only
 * @Date: 2025-02-11 15:22:53
 * @LastEditors: sueRimn
 * @LastEditTime: 2025-02-11 16:12:25
-->
<template>
  <div class="step-container">
    <div class="top-panel">
      <p>流程编号：{{ detail.taskNo }}</p>
      <p>流程名称：{{ detail.taskName }}</p>
    </div>
    <div class="step-panel">
      <div class="title">审核进度</div>
      <div class="info">
        <el-steps :active="active" align-center>
          <el-step
            :title="item.taskName"
            v-for="(item, index) in stepsList"
            :key="index"
          ></el-step>
        </el-steps>
      </div>
    </div>
    <div class="step-panel">
      <div class="title">审核节点</div>
      <div class="info">
        <el-timeline :reverse="false">
          <el-timeline-item
            v-for="(activity, index) in activitiesList"
            :key="index"
            color="#1890ff"
            :timestamp="activity.startTime"
          >
            <p>审核人：{{ activity.assigneeName }}</p>
            <p>审核结果：{{ activity.comment }}</p>
          </el-timeline-item>
        </el-timeline>
      </div>
    </div>
  </div>
</template>

<script>
import { flowTaskInfoForm } from "@/api/flowable/step";
export default {
  data() {
    return {
      loading: null,
      active: 0,
      detail: {},
      stepsList: [],
      activitiesList: [],
    };
  },
  created() {
    this.getLoad();
  },
  methods: {
    /** 初始化加载 */
    getLoad() {
      let taskId = this.$route.query.id;
      if (!taskId) return;
      flowTaskInfoForm({ taskId }).then((res) => {
        let data = res.data;
        this.detail = data;
        this.stepsList = data.taskList || [];
        this.stepsList.forEach((item, index) => {
          if (item.status === "run") {
            this.active = index;
          }
        });
        this.activitiesList = data.recordList || [];
      });
    },
  },
};
</script>

<style lang="scss">
.step-container {
  padding: 20px;
  .top-panel {
    font-size: 13px;
    color: #444;
  }
  .step-panel {
    margin-top: 20px;
    .title {
      font-weight: 600;
      font-size: 15px;
    }
    .info {
      margin-top: 20px;
    }
  }
  .el-step__title {
    font-size: 12px !important;
  }
  .el-step__head.is-process {
    color: #1890ff;
    border-color: #1890ff;
  }
  .el-step__title.is-process {
    color: #1890ff;
  }
  .el-step__title.is-finish,
  .el-step__title.is-wait {
    color: #444;
  }
  .el-step__head.is-finish,
  .el-step__head.is-wait {
    color: #444;
    border-color: #444;
  }
  .el-timeline-item__content {
    p {
      margin: 0;
      padding: 0;
      font-size: 12px;
      line-height: 26px;
    }
  }
}
</style>
